<?php
class Register_m extends Model {
	
	function register_m(){
		parent::Model;
	}
	
	function simpanc(){
		$this->db->select_max('ID_CABANG','max_id');
		$id_la = $this->db->get('cabang');
		foreach ($id_la->result() as $id_ba){
			$id_lam = $id_ba->max_id;
		}
		if ( $id_lam==0 ){
			$id_bar = 20001;
		}
		else {
			$id_bar = $id_lam+1;
		}
		$nama = $this->input->post('nama');
		$email = $this->input->post('email');
		$alamat = $this->input->post('alamat');
		$pass = md5($this->input->post('pass'));
		$kota = $this->input->post('kota');
		$telepon = $this->input->post('telepon');
		
		$db = array(
			'ID_CABANG' => $id_bar,
			'ID_PENGGUNA' => $this->session->userdata('id_induk'),
			'NAMA_C' => $nama,
			'EMAIL_C' => $email,
			'ALAMAT_C' => $alamat,
			'PASSWORD_C' => $pass,
			'KOTA_C' => $kota,
			'TELP_C' => $telepon
		);
		$sim = $this->db->insert('cabang',$db);
		return $sim;
	}
	
	function simpanp(){
		$this->db->select_max('ID_PENGGUNA','max_id');
		$id_la = $this->db->get('pengguna');
		foreach ($id_la->result() as $id_ba){
			$id_lam = $id_ba->max_id;
		}
		if ( $id_lam==0 ){
			$id_bar = 10001;
		}
		else {
			$id_bar = $id_lam+1;
		}
		$nama = $this->input->post('nama');
		$email;
		$alamat;
		$pass;
		$kota;
		$telepon;
		$status;
		
	}
}
?>